//
// Created by 吴锐 on 2022/2/26.
//

#include "iostream"

using namespace std;

class AbstractDrinking {
public:
    virtual void boil() = 0;

    virtual void brew() = 0;

    virtual void pourCup() = 0;

    virtual void putSomething() = 0;

    void makeDrink(){
        boil();
        brew();
        pourCup();
        putSomething();
    }
};

class Coffee : public AbstractDrinking {
public:
    void boil() override {
        cout << "煮农夫山泉" << endl;
    }

    void brew() override {
        cout << "冲泡咖啡" << endl;
    }

    void pourCup() override {
        cout << "倒入杯中" << endl;
    }

    void putSomething() override {
        cout << "加点牛奶" << endl;
    }
};

class Tea : public AbstractDrinking {
public:
    void boil() override {
        cout << "煮百岁山" << endl;
    }

    void brew() override {
        cout << "冲泡茶叶" << endl;
    }

    void pourCup() override {
        cout << "倒入杯中" << endl;
    }

    void putSomething() override {
        cout << "加点枸杞" << endl;
    }
};

void doWork(AbstractDrinking* abs){
    abs->makeDrink();
    delete abs;
}

void test01(){
    doWork(new Coffee);
    cout << "-------------------" << endl;
    doWork(new Tea);
}

int main(){
    test01();
    return 0;
}